<?php

class Share42Widget extends CInputWidget
{
	/**
	 * Assets package ID.
	 */
	const PACKAGE_ID = 'share42';
	/**
	 * Init widget.
	 */
	public function init()
	{
		parent::init();
		$this->registerClientScript();
	}

	/**
	 * Register CSS and Script.
	 */
	protected function registerClientScript()
	{
		/** @var $cs \CClientScript */
		$cs = Yii::app()->clientScript;
		if (!isset($cs->packages[self::PACKAGE_ID])) {
			/** @var $am \CAssetManager */
			$am = Yii::app()->assetManager;
			$cs->packages[self::PACKAGE_ID] = array(
				'basePath' => dirname(__FILE__),
				'baseUrl' => $am->publish(dirname(__FILE__)),
				'js' => array(
					'share42.js',
				),
				'css' => array(
					'style.css',
				),
				'depends' => array(
					'jquery',
				),
			);
		}
		$cs->registerPackage(self::PACKAGE_ID);

	}
}
	